<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="vue.js"></script>
  <style>
    .box{
      width:200px;
      height:200px;
      background: #fc9;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="change">按钮</button>
    <div class="box" ref="box">div</div>
    <div class="box" ref="box2">div</div>
  </div>
  <script>

    let vm = new Vue({
      el:"#app",
      methods:{
        change(){
          // let box = document.querySelector(".box");
          // box.style.background = "red";
          console.log(this.$refs);
          //this.$refs.box.style.background = "red";
          this.$refs['box'].style.background="blue";
        }
      }
    })
  </script>
</body>
</html>